﻿using CubeCube.Object;
using CubeCube.Tile.Rule;

namespace CubeCube.Tile
{
    /*
     * Tile的配置文件(包括规则)
     */
    public class TileDefinition : CCObjectDefine
    {
        public TileDefinition()
            : base(DefinitionType.Tile)
        {

        }

        public const byte EMPTY_TILE_TYPE = 0;

        public enum DrawMode
        {
            NONE,
            SOLID,
            SOLID_ALPHA,
            TRANSPARENT,
            LIQUID
        }

        public byte tileType;                       //Tile 的 id

        //back, front, bottom, top, right, left
        public int[] materials;                    //每个面中使用的纹理索引数组。 顺序：背部，前部，底部，顶部，右侧，左侧。
        public bool animated;                      //Tile 纹理动画
        public DrawMode drawMode;                  //Tile 绘制模式 (SOLID / SOLID_ALPHA / TRANSPARENT / LIQUID)
        public bool castShadow;                    //Tiles 是否投下阴影
        public byte lightSourceIntensity;          //Tile 光源强度(0-14)

        public bool solid;                         //Tile 是否为固体
        public bool liquid;                        //Tile 是否为液体
        public bool burns;                         //Tile 着火时是否会燃烧

        public TileUpdateRules tileUpdateRules;
        public TileActionRules tileActionRules;

        public TileActionRule GetRulesForAction(TileActionRule.ActionType action)
        {
            if (tileActionRules != null)
                return tileActionRules.GetRulesForAction(action);

            return null;
        }
    }
}